package warehouse

import (
	"context"
	"github.com/google/uuid"
	"insighttracking/query/service"
	"net/http"

	"insighttracking/apps/admin/internal/svc"
	"insighttracking/apps/admin/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
	"os"
)

type ModifyStatusByIdApiLogic struct {
	logx.Logger
	ctx     context.Context
	svcCtx  *svc.ServiceContext
	Request *http.Request
}

func NewModifyStatusByIdApiLogic(ctx context.Context, svcCtx *svc.ServiceContext, request *http.Request) *ModifyStatusByIdApiLogic {
	hostname, _ := os.Hostname()
	return &ModifyStatusByIdApiLogic{
		Logger: logx.WithContext(ctx).WithCallerSkip(0).WithFields(
			logx.Field("Log_UUID", uuid.New().String()),
			logx.Field("hostname", hostname)),
		ctx:     ctx,
		svcCtx:  svcCtx,
		Request: request,
	}
}

func (l *ModifyStatusByIdApiLogic) ModifyStatusByIdApi(req *types.IdReq) (resp string, err error) {
	if err = service.WarehouseService.ModifyStatusByIdApi(l.ctx, req.Id); err != nil {
		return "", err
	}
	return "操作成功", nil
}
